<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"  xmlns:th="http://www.thymeleaf.org">
<head>

    <head th:replace="/common/head :: head"></head>


</head>
<body>
<!-- START PAGE CONTAINER -->
<div class="page-container">

    <!-- START PAGE SIDEBAR -->
    <div class="page-sidebar">
        <!-- START X-NAVIGATION -->
        <div th:replace="/common/left :: left"></div>
        <!-- END X-NAVIGATION -->
    </div>
    <!-- END PAGE SIDEBAR -->

    <!-- PAGE CONTENT -->
    <div class="page-content">

        <div th:replace="/common/top :: top"/>

        <!-- START BREADCRUMB -->
        <ul class="breadcrumb">
            <li><a href="#">Home</a></li>
            <li><a href="#">模板管理</a></li>
            <li class="active">属性列表</li>
        </ul>
        <!-- END BREADCRUMB -->

        <!-- PAGE CONTENT WRAPPER -->
        <div class="page-content-wrap">


            <div class="row">
                <div class="col-md-12">

                    <!-- START DATATABLE EXPORT -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">属性列表</h3>
                            <div class="pull-right">

                            </div>
                        </div>
                        <div class="panel-heading" style="float: right;">
                            <div class="btn-group">
                                <button type="button" class="btn btn-success dropdown-toggle"
                                        onclick="add()">
                                    <span class="glyphicon glyphicon-plus"></span>新增
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="button" class="btn btn-success dropdown-toggle"
                                        onclick="copy()">
                                    <span class="fa fa-copy"></span>复制模板属性
                                </button>
                            </div>
                            <div class="pull-right" style="">
                                <div class="btn-group" style="width:180px;">
                                    <select name="appName" class="form-control" id="appName" aria-required="true">
                                        <option value="-1" >公共应用</option>
                                    </select>
                                </div>
                                <div class="btn-group" style="width:300px;">
                                    <select name="templatekey"  id="templateKey" class="form-control" style="width: 280px" >
                                        <option value="-1" >公共模板</option>
                                    </select>
                                </div>
                                <div class="btn-group" style="width:150px;">
                                    <button type="button" class="btn btn-success dropdown-toggle"
                                            onclick="code()">
                                        <span class="fa fa-code"></span>生成java代码
                                    </button>
                                </div>

                                <div class="btn-group" style="width:200px;">
                                    <input name="propertyKey" id="propertyKey" class="form-control" placeholder="属性key" />
                                </div>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-success dropdown-toggle"
                                            onclick="loadData()">
                                        <span class="glyphicon glyphicon-search"></span>查询
                                    </button>
                                </div>
                            </div>
                        </div>

                        <div class="panel-body">
                            <div class="table-responsive">
                                <table id="dataTables-userInfo" class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <th>优先级</th>
                                        <th>应用key</th>
                                        <th>模板key</th>
                                        <th>属性名称</th>
                                        <th>属性key</th>
                                        <th>属性类型</th>
                                        <th>标签类型</th>
                                        <th>前缀变量</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!-- END DATATABLE EXPORT -->

                </div>
            </div>

        </div>
        <!-- END PAGE CONTENT WRAPPER -->
    </div>
    <!-- END PAGE CONTENT -->
</div>
<!-- END PAGE CONTAINER -->

<div id="toolbar">

</div>

<div class="modal fade" id="userInfoDelModal" tabindex="-1" role="dialog"
     aria-labelledby="userInfoDelModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="userInfoDelModalLabel">删除认证</h4>
            </div>
            <div class="modal-body">
                <input id="userInfoId" type="hidden">
                <input id="delAppName" type="hidden" />
                确定要删除么？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="userInfoDel()">删除</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="editModal" tabindex="-1" role="dialog"
     aria-labelledby="userInfoEditModalLabel"
     aria-hidden="true" data-backdrop='static' >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="userInfoEditModalLabel">修改属性</h4>
            </div>
            <div class="modal-body">
                <form id="userInfoEditForm">
                    <input type="hidden" id="editId"  name="id"/>

                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>显示优先级</div>
                        <div class="col-sm-8">
                            <input name="priority" class="form-control" value="1" placeholder="显示优先级" type="text"
                                   onkeyup="this.value=this.value.replace(/\D/g,'')"
                                   onafterpaste="this.value=this.value.replace(/\D/g,'')"
                                   id="editPriority" aria-required="true"/>
                        </div>
                    </div>

                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>选择应用</div>
                        <div class="col-sm-8">
                            <select name="appName" class="form-control" id="editAppName" style="width: 100%">

                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>选择模板</div>
                        <div class="col-sm-8">
                            <select name="templateKey" class="form-control" id="editTemplateKey"  style="width: 100%">

                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性key</div>
                        <div class="col-sm-8">
                            <input name="propertyKey" readonly="readonly" class="form-control" placeholder="5~30位字母 " type="text"
                                   id="editPropertyKey" aria-required="true"/>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性值类型</div>
                        <div class="col-sm-8">
                            <select name="propertyType" class="form-control" readonly="readonly" style="width: 100%" id="editPropertyType" aria-required="true">
                                <option value="varchar">varchar 字符串数据</option>
                                <option value="text">text 长文本数据</option>
                                <option value="tinyint">tinyint (1 byte) 小整数值</option>
                                <option value="int">int (4 bytes) 大整数值</option>
                                <option value="bigint">bigint (8 bytes) 极大整数值</option>
                                <option value="double">double (8 bytes) 双精度浮点数值</option>
                                <option value="decimal">decimal 小数值</option>
                                <option value="date">date (yyyy-MM-dd) 日期值</option>
                                <option value="time">time (HH:mm:ss) 时间值</option>
                                <option value="year">year (yyyy) 年份值</option>
                                <option value="datetime">datetime (yyyy-MM-dd HH:mm:ss) 日期时间</option>
                            </select>

                        </div>
                    </div>
                    <div class="form-group form-group-30" id="editPropertyTypeDiv" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性类型长度</div>
                        <div class="col-sm-8">
                            <input id="editColumnLength" name="columnLength" class="form-control"
                                   onkeyup="this.value=this.value.replace(/\D/g,'')"
                                   onafterpaste="this.value=this.value.replace(/\D/g,'')"
                            />
                        </div>
                    </div>

                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性名称</div>
                        <div class="col-sm-8">
                            <input name="propertyName" class="form-control" placeholder="请输入模板名称" type="text"
                                   id="editPropertyName" aria-required="true"/>
                        </div>
                    </div>

                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>前缀常量</div>
                        <div class="col-sm-8">
                            <select name="variableKey" class="form-control" placeholder="" style="width: 100%" type="text"
                                    id="editVariableKey" aria-required="true">
                            </select>
                        </div>
                    </div>

                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性标签类型</div>
                        <div class="col-sm-8">
                            <select name="labelType" class="form-control" id="editLabelType" style="width: 100%" aria-required="true">
                                <option value="input">input:普通文本框</option>
                                <option value="textarea">textarea:大文本框</option>
                                <option value="select">select:下拉框</option>
                            </select>
                        </div>
                    </div>




                    <input id="editAttributeType" name="attributeType" type="hidden">
                    <input type="hidden" name="labelValue" id="editLabelValue" />

                    <div class="editLableSelectClass">
                        <div class="editLableSelectClass1">

                        </div>
                        <div class="editLableSelectClass2">

                        </div>
                    </div>
                    <input type="reset" name="editReset" style="display: none;"/>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="userInfoEdit()">修改</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="addModal" tabindex="-1" role="dialog"
     aria-labelledby="userInfoAddModalLabel"
     aria-hidden="true"
     data-backdrop='static'
>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="userInfoAddModalLabel">新增属性</h4>
            </div>
            <div class="modal-body">
                <form id="templateAddForm">
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>显示优先级</div>
                        <div class="col-sm-8">
                            <input name="priority" class="form-control" placeholder="添加属性值位置优先级" value="1"
                                   onkeyup="this.value=this.value.replace(/\D/g,'')"
                                   onafterpaste="this.value=this.value.replace(/\D/g,'')"
                                   type="text" id="addPriority" />
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性名称</div>
                        <div class="col-sm-8">
                            <input name="propertyName" class="form-control" placeholder="请输入属性名称" type="text"
                                   id="addPropertyName" />
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性key</div>
                        <div class="col-sm-8">
                            <input name="propertyKey" class="form-control" placeholder="5~30位字母" type="text" id="addPropertyKey" />
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性值类型</div>
                        <div class="col-sm-8">
                            <select name="propertyType" class="form-control select2" style="width: 100%" id="addPropertyType" aria-required="true">
                                <option value="varchar">varchar 字符串数据</option>
                                <option value="text">text 长文本数据</option>
                                <option value="tinyint">tinyint (1 byte) 小整数值</option>
                                <option value="int">int (4 bytes) 大整数值</option>
                                <option value="bigint">bigint (8 bytes) 极大整数值</option>
                                <option value="double">double (8 bytes) 双精度浮点数值</option>
                                <option value="decimal">decimal 小数值</option>
                                <option value="date">date (yyyy-MM-dd) 日期值</option>
                                <option value="time">time (HH:mm:ss) 时间值</option>
                                <option value="year">year (yyyy) 年份值</option>
                                <option value="datetime">datetime (yyyy-MM-dd HH:mm:ss) 日期时间</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" id="addPropertyTypeDiv">
                        <div  class="form-text-right"><span style="color: red;">*</span>属性类型长度</div>
                        <div class="col-sm-8">
                            <input id="addColumnLength" name="columnLength" class="form-control"
                                   onkeyup="this.value=this.value.replace(/\D/g,'')"
                                   onafterpaste="this.value=this.value.replace(/\D/g,'')"
                                   value="255"
                            />
                        </div>
                    </div>


                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>选择应用</div>
                        <div class="col-sm-8">
                            <select name="appName" class="form-control" id="addAppName" style="width: 100%" aria-required="true">

                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" style="display: none;" >
                        <div  class="form-text-right" style="color: red;"><span style="color: red;">*</span>公共属性</div>
                        <div class="col-sm-8">
                            <select id="addAttributeType" name="attributeType" style="width: 100%" class="form-control">
                                <option value="1" >单个模板属性</option>
                                <option value="0" >公共属性</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>选择模板</div>
                        <div class="col-sm-8">
                            <select name="templateKey" class="form-control" style="width: 100%" id="addTemplateKey" aria-required="true">

                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>前缀常量</div>
                        <div class="col-sm-8">
                            <select name="variableKey" class="form-control" placeholder="" style="width: 100%" type="text"
                                    id="addVariableKey" aria-required="true">

                            </select>
                        </div>
                    </div>
                    <div class="form-group form-group-30" >
                        <div  class="form-text-right"><span style="color: red;">*</span>属性标签类型</div>
                        <div class="col-sm-8">
                            <select name="labelType" class="form-control" id="addLabelType" style="width: 100%" aria-required="true">
                                <option value="input">input:普通文本框</option>
                                <option value="textarea">textarea:大文本框</option>
                                <option value="select">select:下拉框</option>
                            </select>
                        </div>
                    </div>



                    <input type="hidden" name="labelValue" id="addLabelValue" />
                    <div class="addLableSelectClass">
                        <div class="addLableSelectClass1">

                        </div>
                        <div class="addLableSelectClass2">

                        </div>
                    </div>
                    <input type="reset" name="addReset" style="display: none;"/>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="addTemplate()">新建</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="copyModal" tabindex="-1" role="dialog"
     aria-labelledby="userInfoAddModalLabel"
     aria-hidden="true"
     data-backdrop='static'

>
    <div class="modal-dialog"  style="width: 60%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" >复制模板属性</h4>
            </div>
            <div class="modal-body">
                <div style="text-align: center;width: 100%;height: 50px;">
                    <button type="button" class="btn btn-success dropdown-toggle" onclick="copyFunction()" >
                        复制原模板属性到目标模板 &nbsp;<span class="glyphicon glyphicon-arrow-right"></span>
                    </button>
                </div>
                <div>
                    <div style="float: left;width: 50%;">
                        <fieldset style="border:1px solid black;padding:5px 5px;">
                            <legend>原模板属性</legend>
                                <div style="border: 0px solid red;height: 40px;" >
                                    <div class="pull-right" style="">
                                        <div class="btn-group">
                                            <select name="appName" class="form-control" id="oldAppName"  style="width:100px;">

                                            </select>

                                        </div>
                                        <div class="btn-group">
                                            <select name="templatekey"  id="oldTemplateKey" class="form-control" style="width:150px" >
                                                <option value="" >公共模板</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div >
                                    <table id="oldTable" class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>
                                                <div class="td-checkbox">
                                                    <input type="checkbox" name="topCheckboxName" class="group-checkable" />
                                                </div>
                                            </th>
                                            <th>属性名称</th>
                                            <th>属性key</th>
                                            <th>属性类型</th>
                                            <th>标签类型</th>
                                            <th>前缀变量</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </div>
                        </fieldset>
                    </div>

                    <div style="float: left;width: 50%;">
                        <fieldset style="border:1px solid black;padding:5px 5px;">
                            <legend>目标模板属性</legend>
                            <div style="border: 0px solid red;height: 40px;" >
                                <div class="pull-right" style="">
                                    <div class="btn-group" >
                                        <select name="appName" class="form-control" id="newAppName" aria-required="true">

                                        </select>
                                    </div>
                                    <div class="btn-group" >
                                        <select name="templatekey"  id="newTemplateKey" class="form-control" style="width: 150px" >
                                            <option value="" >公共模板</option>
                                        </select>
                                    </div>
                                    <div class="btn-group" >
                                        <button type="button" class="btn btn-success dropdown-toggle" onclick="delNewProperty()" >
                                            <span class="glyphicon glyphicon-trash"></span>删除
                                        </button>
                                    </div>
                                </div>
                            </div>
                            <div >
                                <table id="newTable" class="table table-bordered" >
                                    <thead>
                                    <tr>
                                        <th >
                                            <div class="td-checkbox">
                                                <input type="checkbox" name="topCheckboxName" class="group-checkable" />
                                            </div>
                                        </th>
                                        <th>属性名称</th>
                                        <th>属性key</th>
                                        <th>属性类型</th>
                                        <th>标签类型</th>
                                        <th>前缀变量</th>
                                    </tr>
                                    </thead>
                                </table>
                            </div>
                        </fieldset>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="javaModal" tabindex="-1" role="dialog"
     aria-labelledby="userInfoAddModalLabel"
     aria-hidden="true"
     data-backdrop='static'
>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" >java class</h4>
            </div>
            <div class="modal-body">
                <div class="form-group form-group-30" >
                    <div class="col-sm-8">
                        <textarea class="form-control" id="javaContent" rows="3"
                        style="margin: 0px -153.344px 0px 0px; width: 501px; height: 400px;"
                        ></textarea>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<div th:replace="/common/footer :: footer"/>

<script type="text/javascript" th:src="@{/js/admin/property.js}"></script>

</body>
</html>






